#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>

#define N 101
using namespace std; 

int n; 

inline int get_size_0(int row, int col)
{
	return n-col; 
}

inline void go_next_0(int &row, int &col)
{
	col++; 
}

inline int get_size_1(int row, int col)
{
	int a=n-row, b=n-col; 
	return min(a, b); 
}

inline void go_next_1(int &row, int &col)
{
	row++; 
	col++; 
}

inline int get_size_2(int row, int col)
{
	return n-row; 
}

inline void go_next_2(int &row, int &col)
{
	row++; 
}

inline int get_size_3(int row, int col)
{
	int a=n-row, b=col+1; 
	return min(a, b); 
}

inline void go_next_3(int &row, int &col)
{
	row++; 
	col--; 
}

inline int get_size_4(int row, int col)
{
	return col+1; 
}

inline void go_next_4(int &row, int &col)
{
	col--; 
}

inline int get_size_5(int row, int col)
{
	int a=col+1, b=row+1; 
	return min(a, b); 
}

inline void go_next_5(int &row, int &col)
{
	col--; 
	row--; 
}

inline int get_size_6(int row, int col)
{
	return row+1; 
}

inline void go_next_6(int &row, int &col)
{
	row--; 
}

inline int get_size_7(int row, int col)
{
	int a=row+1, b=n-col; 
	return min(a, b); 
}

inline void go_next_7(int &row, int &col)
{
	row--; 
	col++; 
}

inline int get_size(int dir, int row, int col)
{
	switch(dir) {
	case 0: return get_size_0(row, col); 
	case 1: return get_size_1(row, col); 
	case 2: return get_size_2(row, col); 
	case 3: return get_size_3(row, col); 
	case 4: return get_size_4(row, col); 
	case 5: return get_size_5(row, col); 
	case 6: return get_size_6(row, col); 
	case 7: return get_size_7(row, col); 
	default: assert(0); break; 
	}
	return 0; 
}

inline void go_next(int dir, int &row, int &col)
{
	switch(dir) {
	case 0: go_next_0(row, col); return; 
	case 1: go_next_1(row, col); return; 
	case 2: go_next_2(row, col); return; 
	case 3: go_next_3(row, col); return; 
	case 4: go_next_4(row, col); return; 
	case 5: go_next_5(row, col); return; 
	case 6: go_next_6(row, col); return; 
	case 7: go_next_7(row, col); return; 
	default: assert(0); break; 
	}
}



int main()
{
	vector<string> a, b; 
	int col, row, c, r, dir, size, i, found; 
	const char *pat="yizhong"; 
	
	//freopen("p1101.in", "r", stdin); 
	
	cin>>n; 
	a.resize(n); 
	b.resize(n); 
	for (row=0; row<n; row++) {
		cin>>a[row]; 
		b[row] = string(n, 'x'); 
		//cout<<"row="<<row<<", str=["<<a[row]<<"]\n"; 
	}
	
	for (row=0; row<n; row++) {
		for (col=0; col<n; col++) {
			for (dir=0; dir<8; dir++) {
				size = get_size(dir, row, col); 
				if (size<7)
					continue; 
				r = row; 
				c = col;
				found = 1; 
				for (i=0; i<7; i++) {
					if (a[r][c]!=pat[i]) {
						found = 0; 
						break; 
					}
					go_next(dir, r, c); 
				}
				if (found) {
					r = row; 
					c = col;
					for (i=0; i<7; i++) {
						b[r][c] = 's'; 
						go_next(dir, r, c); 
					}
				}
			}
		}
	}
	for (r=0; r<n; r++) {
		for (c=0; c<n; c++) {
			if (b[r][c]=='s') {
				cout<<a[r][c]; 
			} else {
				cout<<'*'; 
			}
		}
		cout<<endl; 
	}	
	return 0; 
}


